/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：MapTile.java <br>
 * 创建时间：2013-5-21 下午12:23:50 <br>
 * 所属项目：GmudEX <br>
 * @author 12548 <br>
 */
package lostland.gmud.exv2;

import android.graphics.Canvas;

import lostland.gmud.exv2.blgframework.impl.BLGGraphics;
import lostland.gmud.exv2.blgframework.impl.BLGPixmap;


/**
 * 类名：MapTile <br>
 * 说明：地图瓦块绘制。
 *
 * @author 12548
 */
public class MapTile extends Tileset {

	public final static int TILE_WIDTH = 32;
	private static final MapTile mapTile = new MapTile();


	private MapTile() {
		super((BLGPixmap) Assets.getMapTile(), TILE_WIDTH, TILE_WIDTH);
	}

	public void drawInMap(int x, int y, int srcX, int srcY, int dx, int dy) {
		pixmap = (BLGPixmap) Assets.getMapTile();
		super.drawInMap((BLGGraphics) Game.getInstance().getGraphics(), x * TILE_WIDTH + dx, y * TILE_WIDTH + dy, srcX, srcY);
	}

	public void drawInCanvas(int x, int y, int srcX, int srcY, int dx, int dy, Canvas cv) {
		pixmap = (BLGPixmap) Assets.getMapTile();
		super.drawInCanvas((BLGGraphics) Game.getInstance().getGraphics(), x * TILE_WIDTH + dx, y * TILE_WIDTH + dy, srcX, srcY, cv);
	}

	public void drawInMap(int x, int y, int srcX, int srcY) {
		pixmap = (BLGPixmap) Assets.getMapTile();
		drawInMap(x, y, srcX, srcY, 0, 0);
	}

	public void draw(int x, int y, int srcX, int srcY, int dx, int dy) {
		pixmap = (BLGPixmap) Assets.getMapTile();
		super.draw((BLGGraphics) Game.getInstance().getGraphics(), x * TILE_WIDTH + dx, y * TILE_WIDTH + dy, srcX, srcY);
	}

	public void draw(int x, int y, int srcX, int srcY) {
		pixmap = (BLGPixmap) Assets.getMapTile();
		draw(x, y, srcX, srcY, 0, 0);
	}

	public static MapTile getInstance() {
		return mapTile;
	}
}
